This issue is really driving me nuts!!!! |
Re: This include function is not behaving as expected. I wrote the below first, but looking more closely I see this: Once you get keyword for strDefWorkPlan, your code should append most of the rest of the lines read to ConfigInfo[4], since nDefWP is never set to zero. Also, ConfigInfo[3] should also get a bunch of unwanted appends since nProcEdit is set to zero in an odd place.
If my guesses below for the format of the file is incorrect, then you will need to post your rules for your input file. -Louie I wrote the following, some of which may help: Are you saying that the print at line 56:
The code seems good so I'm guessing the problem is with your input, which must have these characteristics: [1] your input file looks something like this: KeyWord strReleaseNum data strReleaseNum KeyWord strBuildNum data strBuildNum KeyWord strDefLanguage data strDefLanguage KeyWord strDefWorkPlan data strDefWorkPlan KeyWord strProcEdit data strProcEdit that is, when one line has a recognized KeyWord then the next line contains the data for that key word you want to put into your output array. [2] There is no Data line that can look like a Keyword line <-- I think this is the problem. Perhaps the following debug statements will help:
The existance of line 61 gives me the HeeBee-JeeBees; can you have two keywords in a row? Should not this line be at about line 81 instead?
If I'm on the right track here, you may be better off combining your 5 "n" integers into an integer "Mode" variable. if mode== -1 then process strCfgFile as a KeyWord; which sets Mode = 0, 1,2,3,or 4 elseif mode== 0 then process strCfgFile as a strReleaseNum data;Mode = -1 elseif mode== 1 then process strCfgFile as a strBuildNum data; Mode = -1 etc -Louie |
Re: This include function is not behaving as expected. llandale - Mon Jan 16 14:55:03 EST 2012
If my guesses below for the format of the file is incorrect, then you will need to post your rules for your input file. -Louie I wrote the following, some of which may help: Are you saying that the print at line 56:
The code seems good so I'm guessing the problem is with your input, which must have these characteristics: [1] your input file looks something like this: KeyWord strReleaseNum data strReleaseNum KeyWord strBuildNum data strBuildNum KeyWord strDefLanguage data strDefLanguage KeyWord strDefWorkPlan data strDefWorkPlan KeyWord strProcEdit data strProcEdit that is, when one line has a recognized KeyWord then the next line contains the data for that key word you want to put into your output array. [2] There is no Data line that can look like a Keyword line <-- I think this is the problem. Perhaps the following debug statements will help:
The existance of line 61 gives me the HeeBee-JeeBees; can you have two keywords in a row? Should not this line be at about line 81 instead?
If I'm on the right track here, you may be better off combining your 5 "n" integers into an integer "Mode" variable. if mode== -1 then process strCfgFile as a KeyWord; which sets Mode = 0, 1,2,3,or 4 elseif mode== 0 then process strCfgFile as a strReleaseNum data;Mode = -1 elseif mode== 1 then process strCfgFile as a strBuildNum data; Mode = -1 etc -Louie Thanks for replying. Here is my code, properly formatted. {code} void ReadConfigFile(string ConfigInfo[]) { int nRN = 0 int nBN = 0 int nDL = 0 int nProcEdit = 0 int nDefWP = 0 string strCfgFile string ConfigFile = ConfigFileTemplate // Global variable, not defined inside any function bool VerFileExists = canOpenFile(ConfigFile, false) if (VerFileExists) // compare the obj file with documented, report any discrepancies { Stream g_stInput = read (ConfigFile)// Global variable, not defined inside any function while (true) { g_stInput >> strCfgFile // read a line at a time if (end of g_stInput) break // in Conf, this must be called before string is used! if (strCfgFile == strReleaseNum) { nRN = 1 continue //skip to next line to read in } // end if (strCfgFile == strReleaseNum) if (nRN == 1) { ConfigInfo[0] = strCfgFile nRN = 0 }// end if (nRN == 1) if (strCfgFile == strBuildNum) { nBN = 1 continue //skip to next line to read in } // end if (strCfgFile == strBuildNum) if (nBN == 1) { ConfigInfo[1] = strCfgFile nBN = 0 } // end if (nBN == 1) if (strCfgFile == strDefLanguage) { nDL = 1 continue //skip to next line to read in } // end if (strCfgFile == strDefLanguage) if (nDL == 1) { ConfigInfo[2] = strCfgFile print nDL" nDL -> ConfigInfo[2] = "ConfigInfo[2]"\n" nDL = 0 } if (strCfgFile == strDefWorkPlan) { nProcEdit = 0 nDefWP = 1 continue //skip to next line to read in } // end if (strCfgFile == strDefWorkPlan) if (nDefWP == 1) { string strTemp = ConfigInfo[4] strTemp = strTemp strCfgFile"\n" ConfigInfo[4] = strTemp } // end if (nProcEdit == 1) if (strCfgFile == strProcEdit) { nProcEdit = 1 continue //skip to next line to read in } // end if (strCfgFile == strProcEdit) if (nProcEdit == 1) { // Assemble the total string one line at a time. string strTemp = ConfigInfo[3] strTemp = strTemp strCfgFile"\n" ConfigInfo[3] = strTemp } // end if (nProcEdit == 1) } // end while (true) close g_stInput // close the file that was read in nDefWP = 0 } // end if (VerFileExists) // compare the obj file with documented, report any discrepancies else print "No VerFileExists!!!\n" } // ReadConfigFile {/code} Here is my input file: Release Number: 6.9.5 Release 1 Build Number: 6.9.5.3034 Default Language: English Languages: Chinese (Simplified) Danish Dutch English French German Italian Japanese Norwegian Spanish Swedish Procedure Edit Template: Reason for Procedure edit: Procedure edit: Action Taken: Proceeded as instructed in above procedure edit Reviewed with: Approved by: DEFERRED WORKPLAN: This step is not required to be executed per DOC0639333 MLCL 6.9 Verification Work Plan. Here is the print statement result: 0 nDL -> ConfigInfo[2] = 6.9.5 Release 1 0 nDL -> ConfigInfo[2] = 6.9.5.3034 1 nDL -> ConfigInfo[2] = English 0 nDL -> ConfigInfo[2] = Languages: 0 nDL -> ConfigInfo[2] = Chinese (Simplified) 0 nDL -> ConfigInfo[2] = Danish 0 nDL -> ConfigInfo[2] = Dutch 0 nDL -> ConfigInfo[2] = English 0 nDL -> ConfigInfo[2] = French 0 nDL -> ConfigInfo[2] = German 0 nDL -> ConfigInfo[2] = Italian 0 nDL -> ConfigInfo[2] = Japanese 0 nDL -> ConfigInfo[2] = Norwegian 0 nDL -> ConfigInfo[2] = Spanish 0 nDL -> ConfigInfo[2] = Swedish 0 nDL -> ConfigInfo[2] = Procedure Edit Template: 0 nDL -> ConfigInfo[2] = Reason for Procedure edit: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Procedure edit: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Action Taken: 0 nDL -> ConfigInfo[2] = Proceeded as instructed in above procedure edit 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Reviewed with: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Approved by: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = DEFERRED WORKPLAN: 0 nDL -> ConfigInfo[2] = This step is not required to be executed per DOC0639333 MLCL 6.9 Verification Work Plan. 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = When I go to actually read the data in ConfigInfo[2], it is set to null, as seen in the last print statement. The nProcEdit and nDefWP clearing take place when it is at the next sequence; i.e., the others are all one line entries, whereas, ProcEdit and DefWP are set up to be multiple lines. |
Re: This include function is not behaving as expected. Here is the print result with your tabbing suggestion: ... 0 0 0 0 0 Previous Line:[ ... 1 0 0 0 0 Previous Line:[Release Number: 0 nDL -> ConfigInfo[2] = 6.9.5 Release 1 ... 0 0 0 0 0 Previous Line:[6.9.5 Release 1 ... 0 1 0 0 0 Previous Line:[Build Number: 0 nDL -> ConfigInfo[2] = 6.9.5.3034 ... 0 0 0 0 0 Previous Line:[6.9.5.3034 ... 0 0 1 0 0 Previous Line:[Default Language: 1 nDL -> ConfigInfo[2] = English ... 0 0 0 0 0 Previous Line:[English 0 nDL -> ConfigInfo[2] = Languages: ... 0 0 0 0 0 Previous Line:[Languages: 0 nDL -> ConfigInfo[2] = Chinese (Simplified) ... 0 0 0 0 0 Previous Line:[Chinese (Simplified) 0 nDL -> ConfigInfo[2] = Danish ... 0 0 0 0 0 Previous Line:[Danish 0 nDL -> ConfigInfo[2] = Dutch ... 0 0 0 0 0 Previous Line:[Dutch 0 nDL -> ConfigInfo[2] = English ... 0 0 0 0 0 Previous Line:[English 0 nDL -> ConfigInfo[2] = French ... 0 0 0 0 0 Previous Line:[French 0 nDL -> ConfigInfo[2] = German ... 0 0 0 0 0 Previous Line:[German 0 nDL -> ConfigInfo[2] = Italian ... 0 0 0 0 0 Previous Line:[Italian 0 nDL -> ConfigInfo[2] = Japanese ... 0 0 0 0 0 Previous Line:[Japanese 0 nDL -> ConfigInfo[2] = Norwegian ... 0 0 0 0 0 Previous Line:[Norwegian 0 nDL -> ConfigInfo[2] = Spanish ... 0 0 0 0 0 Previous Line:[Spanish 0 nDL -> ConfigInfo[2] = Swedish ... 0 0 0 0 0 Previous Line:[Swedish 0 nDL -> ConfigInfo[2] = Procedure Edit Template: ... 0 0 0 1 0 Previous Line:[Procedure Edit Template: 0 nDL -> ConfigInfo[2] = Reason for Procedure edit: ... 0 0 0 1 0 Previous Line:[Reason for Procedure edit: 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = Procedure edit: ... 0 0 0 1 0 Previous Line:[Procedure edit: 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = Action Taken: ... 0 0 0 1 0 Previous Line:[Action Taken: 0 nDL -> ConfigInfo[2] = Proceeded as instructed in above procedure edit ... 0 0 0 1 0 Previous Line:[Proceeded as instructed in above procedure edit 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = Reviewed with: ... 0 0 0 1 0 Previous Line:[Reviewed with: 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = Approved by: ... 0 0 0 1 0 Previous Line:[Approved by: 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 1 0 Previous Line:[ 0 nDL -> ConfigInfo[2] = DEFERRED WORKPLAN: ... 0 0 0 0 1 Previous Line:[DEFERRED WORKPLAN: 0 nDL -> ConfigInfo[2] = This step is not required to be executed per DOC0639333 MLCL 6.9 Verification Work Plan. ... 0 0 0 0 1 Previous Line:[This step is not required to be executed per DOC0639333 MLCL 6.9 Verification Work Plan. 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ 0 nDL -> ConfigInfo[2] = ... 0 0 0 0 1 Previous Line:[ I do not see a Preview button, only Post Message, Save draft, Discard |
Re: This include function is not behaving as expected. Thanks for the suggestion of using Mode. I changed it to use a mode value, with 1-5. After each mode is finished, I reset the mode to 0(If I did not, then I get the same issue that I originally posted for). I really appreciate the time you took to look into this issue for me. |
Re: This include function is not behaving as expected. Gedinfo - Mon Jan 16 15:09:38 EST 2012 Here is the print statement result: 0 nDL -> ConfigInfo[2] = 6.9.5 Release 1 0 nDL -> ConfigInfo[2] = 6.9.5.3034 1 nDL -> ConfigInfo[2] = English 0 nDL -> ConfigInfo[2] = Languages: 0 nDL -> ConfigInfo[2] = Chinese (Simplified) 0 nDL -> ConfigInfo[2] = Danish 0 nDL -> ConfigInfo[2] = Dutch 0 nDL -> ConfigInfo[2] = English 0 nDL -> ConfigInfo[2] = French 0 nDL -> ConfigInfo[2] = German 0 nDL -> ConfigInfo[2] = Italian 0 nDL -> ConfigInfo[2] = Japanese 0 nDL -> ConfigInfo[2] = Norwegian 0 nDL -> ConfigInfo[2] = Spanish 0 nDL -> ConfigInfo[2] = Swedish 0 nDL -> ConfigInfo[2] = Procedure Edit Template: 0 nDL -> ConfigInfo[2] = Reason for Procedure edit: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Procedure edit: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Action Taken: 0 nDL -> ConfigInfo[2] = Proceeded as instructed in above procedure edit 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Reviewed with: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = Approved by: 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = DEFERRED WORKPLAN: 0 nDL -> ConfigInfo[2] = This step is not required to be executed per DOC0639333 MLCL 6.9 Verification Work Plan. 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = 0 nDL -> ConfigInfo[2] = When I go to actually read the data in ConfigInfo[2], it is set to null, as seen in the last print statement. The nProcEdit and nDefWP clearing take place when it is at the next sequence; i.e., the others are all one line entries, whereas, ProcEdit and DefWP are set up to be multiple lines.
Good idea to have an editor that displays all the white space. -Louie |